﻿using WH.Model.Bases;
using WH.Common.Attributes;
using WH.Common.Constant;
using SqlSugar;

namespace WH.Model.Systems
{
    ///<summary>
    ///选项数据字典明细信息表
    ///</summary>
    [SugarTable("sys_key_value")]
    [RemoveCache(BusinessFunction.KeyValueCacheKey)]
    public class KeyValueEntity : BaseOrgAuditableEntity
    {
        /// <summary>
        /// 父节点id 默认为0位顶节点
        /// 默认值:
        /// </summary>      
        [SugarColumn(ColumnName = "parent_id", IsNullable = true, Length = 50, ColumnDescription = "父节点id 默认为0位顶节点")]
        public string ParentId { get; set; } = null!;

        /// <summary>
        /// 层次 例如 0级 1级 2级 3级 用数字代替
        /// 默认值:
        /// </summary>
        [SugarColumn(ColumnName = "layer", IsNullable = true, Length = 11, ColumnDescription = "层次 例如 0级 1级 2级 3级 用数字代替")]
        public int Layer { get; set; }

        /// <summary>
        /// 完整链路路径
        /// </summary>
        [SugarColumn(ColumnName = "link", IsNullable = true, Length = 255, ColumnDescription = "完整链路路径")]
        public string Link { get; set; } = null!;

        /// <summary>
        /// 是否为叶子节点
        /// </summary>
        [SugarColumn(ColumnName = "is_leaf", IsNullable = false, Length = 1, ColumnDescription = "是否为叶子节点")]
        public bool IsLeaf { get; set; }

        /// <summary>
        /// 类型编号
        /// </summary>
        [SugarColumn(ColumnName = "code", IsNullable = false, Length = 255, ColumnDescription = "类型编号")]
        public string Code { get; set; } = null!;

        /// <summary>
        /// 名称
        /// </summary>
        [SugarColumn(ColumnName = "name", IsNullable = false, Length = 50, ColumnDescription = "名称")]
        public string Name { get; set; } = null!;

        /// <summary>
        /// 图标
        /// </summary>
        [SugarColumn(ColumnName = "icon_url", IsNullable = true, Length = 255, ColumnDescription = "图标")]
        public string IconUrl { get; set; } = null!;

        /// <summary>
        /// 是否可删除（0否 1是）
        /// </summary>
        [SugarColumn(ColumnName = "is_deletable", IsNullable = true, Length = 1, ColumnDescription = "是否可删除（0否 1是）")]
        public bool IsDeletable { get; set; }

        /// <summary>
        /// 排序码 数字越小越靠前
        /// </summary>
        [SugarColumn(ColumnName = "sort_code", IsNullable = true, Length = 11, ColumnDescription = "排序码 数字越小越靠前")]
        public int SortCode { get; set; }

        /// <summary>
        /// 状态（0停用 1正常）
        /// </summary>
        [SugarColumn(ColumnName = "is_enable", IsNullable = true, Length = 1, ColumnDescription = "状态（0停用 1正常）")]
        public bool IsEnable { get; set; }

        /// <summary>
        /// 描述/备注说明
        /// </summary>
        [SugarColumn(ColumnName = "remark", IsNullable = true, Length = 255, ColumnDescription = "描述/备注说明")]
        public string? Remark { get; set; }

        /// <summary>
        /// 输入码
        /// </summary>
        [SugarColumn(ColumnName = "input_code", IsNullable = true, Length = 50, ColumnDescription = "输入码")]
        public string? InputCode { get; set; }


        /// <summary>
        /// 
        /// </summary>
        [SugarColumn(ColumnName = "organization_id", IsNullable = true, Length = 50, ColumnDescription = "机构id")]
        public new string OrganizationId { get; set; } = null!;

    }
}